#ifndef __BULLET_BLOCK_H__
#define __BULLET_BLOCK_H__

#include "Block.hpp"

namespace PocketSurvival
{
	enum class BulletType
	{
		None,
		MusketBall,
		Buckshot,
		BuckshotBall
	};

    // 子弹
    class BulletBlock : public Block
    {
    public:
        static constexpr int32_t Index()
        {
            return 214;
        }
        virtual int32_t getIndex() override; 
        virtual const std::string &getBlockName() override;

		virtual float getExplosionPressure(int32_t value) override;
		virtual float getProjectilePower(int32_t value) override;
        virtual void getCreativeValues(std::vector<int32_t> &blockVec) override;

		static inline BulletType GetBulletType(int32_t data);
		static inline int32_t SetBulletType(int32_t data, BulletType bulletType);
    };

	inline BulletType BulletBlock::GetBulletType(int32_t data)
	{
		return (BulletType)((data & 0xF) + 1);
	}

	inline int32_t BulletBlock::SetBulletType(int32_t data, BulletType bulletType)
	{
		return (data & -16) | (((int32_t)bulletType - 1) & 0xF);
	}

} // namespace PocketSurvival


#endif
